﻿using BookFly.ViewModels;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BookFly
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            this.DataContext = new MainWindowViewModel();
           
            
            priceGrid.ItemsSource = (this.DataContext as MainWindowViewModel).FlightPriceTable.DefaultView;
            AddColumns();
        }

        private void AddColumns()
        {
            var vm = this.DataContext as MainWindowViewModel;
            vm.FlightPriceTable.Columns.Add("目标城市", typeof(string));
            DateTime dateNow = DateTime.Now;
            for (int i = 1; i <= 100; i++)
            {
                var date = dateNow.AddDays(i);
                vm.FlightPriceTable.Columns.Add($"{date.ToString("Mdd")}", typeof(string));            
            }

        }
    }
}